package Solution.problem057;

/**
 * @program Leetcode
 * @description:
 * @author: lishangsheng
 * @create: 2019/05/30 16:49
 */
public class BetterSolution {
    public int lengthOfLastWord(String s) {
        int count=0;
        s = s.trim();
        for(int i=s.length()-1;i>=0;i--){
            if(s.charAt(i)!=' '){
                count++;
            }else{
                break;
            }
        }
        return count;
    }
}
